import { baseUrl, Get, Post } from '../../server'

const severName = 'supply' // 服务前缀名
const newBaseUrl = baseUrl + severName

// 库存数量
// http://yapi.tiens.com/project/550/interface/api/33123
const sthCountBar: any = () => {
  const url = `${newBaseUrl}/v1/stock/num/`
  return Get(url)
}

// 库存金额
const sthMoneyBar: any = () => {
  const url = `${newBaseUrl}/v1/stock/amount/`
  return Get(url)
}

// 入库出库数量展示
const inOutSthCountBar: any = () => {
  const url = `${newBaseUrl}/v1/stock/storage/`
  return Get(url)
}

// top10出库金额占比
const top10MoneyBar: any = () => {
  const url = `${newBaseUrl}/v1/stock/best/seller/amount/`
  return Get(url)
}

// top10出库数量占比
const top10CountBar: any = () => {
  const url = `${newBaseUrl}/v1/stock/best/seller/number/`
  return Get(url)
}

// 国家库存结构
const countrySthBar: any = () => {
  const url = `${newBaseUrl}/v1/stock/inventory/structure/`
  return Get(url)
}

// 在制、在库、在途订单金额汇总
const moneySummary: any = () => {
  const url = `${newBaseUrl}/v1/stock/goods/process/`
  return Get(url)
}

//全球库存变化趋势图
//http://yapi.tiens.com/project/550/interface/api/33131
const inventoryTrendReq: any = (params) => {
  const url = `${newBaseUrl}/v1/stock/num/`
  return Post(url,params)
}

//库存数量与出库数量对比
//http://yapi.tiens.com/project/550/interface/api/33183
const inventoryOutBoundReq: any = (params) => {
  const url = `${newBaseUrl}/v1/stock/inventory/outbound/`
  return Get(url)
}

//呆滞库存
//http://yapi.tiens.com/project/550/interface/api/33195
const inventoryUnSaleableReq: any = (params) => {
  const url = `${newBaseUrl}/v1/stock/unsalable/`
  return Get(url)
}

//区域库存周转率/区域库存周转天数
//http://yapi.tiens.com/project/550/interface/api/33187
const inventoryTurnoverReq: any = (params) => {
  const url = `${newBaseUrl}/v1/stock/turnover/`
  return Get(url)
}
//全球仓库数
//http://yapi.tiens.com/project/550/interface/api/33191
const supplyWarehouseNum: any = (params) => {
  const url = `${newBaseUrl}/v1/stock/warehouse/num/`
  return Get(url)
}

export const supplyApi: any = {
  sthCountBar, // 库存数量
  sthMoneyBar, // 库存金额
  inOutSthCountBar, // 入库出库数量展示
  top10MoneyBar, // top10出库金额占比
  top10CountBar, // top10出库数量占比
  countrySthBar, // 国家库存结构
  moneySummary, // 在制、在库、在途订单金额汇总
  inventoryTrendReq, //全球库存变化趋势图
  inventoryOutBoundReq, //库存数量与出库数量对比
  inventoryUnSaleableReq, //呆滞库存
  inventoryTurnoverReq, //区域库存周转率/区域库存周转天数
  supplyWarehouseNum, //仓库数
}
